package com.vueperson.vueperson.t1.CreationalPattern.SingletonPattern.IoDH;

public class Singleton {
    private Singleton(){}

    //静态内部类
    private static class HolderClass{
        private final static Singleton instance=new Singleton();

    }

    public static Singleton getInstance(){
        return HolderClass.instance;

    }

    public static void main(String[] args) {
        Singleton singleton1,singleton2;
        singleton1=Singleton.getInstance();
        singleton2=Singleton.getInstance();
        System.out.println(singleton1==singleton2);
    }
}
